# 多层框架、窗口定位
import time

from selenium import webdriver
import os
driver = webdriver.Chrome()
file = "file:///" + os.path.abspath("e:/比特课件/selenium2html/frame.html")
driver.get(file)
#转换层级
driver.switch_to.frame("f1")
driver.switch_to.frame("f2")

driver.find_element_by_id("kw").send_keys("刘亦菲")
driver.find_element_by_id("su").click()

# 回到默认页面
driver.switch_to.default_content()
driver.switch_to.frame("f1")
driver.find_element_by_link_text("click").click()

time.sleep(3)
driver.quit()


